package com.easygem.controller.system;

import com.easygem.common.error.SystemException;
import com.easygem.common.response.ResponseMessage;
import com.easygem.common.vo.system.WelcomeVO;
import com.easygem.system.service.WelcomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author 罗力
 * @version 1.0
 * @className WelcomeController
 * @description TODO 欢迎页控制层
 * @date 2025/3/2 13:13
 */
@Controller
@RequestMapping("/system/welcome")
public class WelcomeController {
    @Autowired
    private WelcomeService welcomeService;

    @GetMapping("/getCount")
    @ResponseBody
    public ResponseMessage<Map<String,Integer>> getInfo() throws SystemException {
        Map<String,Integer> map = new HashMap<>();
        map.put("seatCount",welcomeService.getSeatCount());
        map.put("clientCount",welcomeService.getClientCount());
        map.put("deptCount",welcomeService.getDeptCount());
        map.put("callCount",welcomeService.getCallCount());
        return ResponseMessage.success(map);
    }

    @GetMapping("/getAccountInfo")
    @ResponseBody
    public ResponseMessage<List<WelcomeVO>> getAccountInfo() throws SystemException {
        List<WelcomeVO>  welcomeVO = welcomeService.getAccountInfo();
        return ResponseMessage.success(welcomeVO);
    }
}
